%% 
%% This is file `delex.tex', generated 
%% on <1995/3/4> with the docstrip utility (2.2i).
%% 
%% The original source files were:
%% 
%% deleq.dtx  (with options: `exempelkod')
%% 
%% Copyright (c) 1994 by Mats Dahlgren <matsd@physchem.kth.se>. 
%% All rights reserved. See the file `deleq.ins' for information 
%% on how you may (re-)distribute the `deleq' package files. 
%% 
\documentclass[11pt]{article} %%% add `leqno' if you want left-aligned
\usepackage{deleq}            %%%                    equation numbers.
\oddsidemargin=0.5cm
\evensidemargin=0.5cm
\topmargin=-5mm
\textheight=23.5cm
\textwidth=15.5cm
\begin{document}
  \begin{center}
  \Large Welcome to the \texttt{deleq} package!
  \end{center}

  This is a short document to demonstrate the use of the
  \texttt{deleq} package and its commands.  It uses \deleqver .
  \texttt{deleq} was written by Mats Dahlgren
  (\texttt{matsd@physchem.kth.se}).  Suggestions for
  improvements and bug reports are most welcome, see the
  documentation.  \texttt{deleq} is fully compatible with the
  \texttt{leqno} option.

  We start this demonstration by a simple and well-known
  equation to get the equation number counter going:
  \begin{equation}
    \sin^2\alpha + \cos^2\alpha = 1
  \end{equation}
  The first example will be to make use of the
  \texttt{deqn} environment to get a partially numbered
  equation:
  \begin{deqn}
    \sin (-\alpha) = - \sin \alpha
  \end{deqn}
  This equation has its cosine companion, here written in
  the \texttt{ddeqn} environment:
  \begin{ddeqn}
    \cos (-\alpha) = \cos \alpha
  \end{ddeqn}
  Not so exciting, so far. :--)

  In the next example we introduce the \texttt{deqarr}
  environment for writing equations:
  \begin{deqarr}
    \sin ( \alpha + \beta ) & =
      & \sin \alpha \cos \beta + \sin \beta \cos \alpha \\
    \sin ( \alpha - \beta ) & =
      & \sin \alpha \cos \beta - \sin \beta \cos \alpha
    \label{Demo1}
  \end{deqarr}
  where we also have put in the label \texttt{Demo1} in
  the second equation. Next, notice how the environment
  \texttt{ddeqar} uses the same main equation number as
  the previous equations:
  \begin{ddeqar}
    \cos ( \alpha + \beta ) & =
      & \cos \alpha \cos \beta - \sin \alpha \sin \beta \\
    \cos ( \alpha - \beta ) & =
      & \cos \alpha \cos \beta + \sin \alpha \sin \beta
  \end{ddeqar}
  Now, we will make another \texttt{eqnarray}-like
  structure, again in the \texttt{ddeqar} environment:
  \begin{ddeqar}
    \sin 2\alpha & =
      & 2 \sin \alpha \cos \alpha \heqno \label{Demo2} \\
    \cos 2\alpha & =
      & \cos ^2 \alpha - \sin ^2 \alpha \nydeqno \\
  \rem{or}
      & = & 2\cos ^2 \alpha - 1
  \end{ddeqar}
  This example shows the use of \verb$\heqno$ in the first
  equation, which produces an ordinary equation number.
  The first equation is also labelled, with the label
  \texttt{Demo2}.  The next equation's number was produced
  by the command \verb$\nydeqno$.  Also, notice the use of
  \verb+\rem{or}+, which results in the text ``or'' without
  changing the alignment.

  To step the equation number counter, we want the
  following equations typeset in ordinary
  \texttt{eqnarray} environment:
  \begin{eqnarray}
    \tan ^2 \alpha & =
      & \frac{\sin ^2 \alpha}{\cos ^2 \alpha} \label{Demo3} \\
    \tan \alpha & =
      & \frac{\sin \alpha}{\cos \alpha}
  \end{eqnarray}
  The upper equation was given the label \texttt{Demo3}.

  Now one of the ``recycling'' commands is to be
  demonstrated.  First of all, let's make an ordinary
  reference to equation~\ref{Demo2}, and then ``recycle'' it:
  $$ \sin 2\alpha = 2 \sin \alpha \cos \alpha \reqno{Demo2} $$
  This was obtained with \verb#$$ ... $$# with the command
  \verb#\reqno{Demo2}# at the end.  Also partially
  numbered equations can be recycled with the
  \verb#\reqno{FOO}# command, as with
  equation~\ref{Demo1}:
  $$ \sin ( \alpha - \beta ) = \sin \alpha \cos \beta -
    \sin \beta \cos \alpha \reqno{Demo1} $$
  (However, the use of \verb#\rndeqno{FOO}# and
  \verb#\rdeqno{FOO}# will produce strange results with
  two (different) partial equation numbers if \texttt{FOO}
  refers to a partially numbered equation.)

  The next equation was written with \verb#$$ ... $$# and
  a \verb#\deleqno# command at the end:
  $$ \tan 2\alpha = \frac{2\tan \alpha}{1 - \tan ^2 \alpha} \deleqno $$
  Notice how the main equation number counter is still the
  same, despite that we now are outside of the
  \texttt{ddeqar} environment. Also, notice how the use of
  \verb#\reqno# above did not affect the equation number
  counter. The following equation is also set within
  \verb#$$ ... $$#, but it uses the command
  \verb#\nydeleqno# to produce an equation number with a
  new main number:
  $$ \sin ^2 \alpha = 1 - \cos ^2 \alpha \nydeleqno $$

  Now we will elaborate a little on \verb#\rndeqno{FOO}#
  and \verb#\rdeqno{FOO}#. Let us use
  equation~\ref{Demo3}, and see what happens if we use the
  \verb#\rndeqno{FOO}# command:
  $$ \tan ^2 \alpha = \frac{\sin ^2 \alpha}
    {\cos ^2 \alpha} \rndeqno{Demo3} $$
  which we rewrite:
  $$ \tan ^2 \alpha = \frac{\sin ^2 \alpha}
    {1 - \sin ^2 \alpha} \rdeqno{Demo3}  \label{Demo4} $$
  with \verb#\rdeqno{Demo3}# at the end.  This is great
  fun, so why not one more:
  $$ \tan ^2 \alpha = \frac{1 - \cos ^2 \alpha}
    {\cos ^2 \alpha} \rdeqno{Demo3} $$
  Also, the middle form of equation~\ref{Demo3} got a
  label, \texttt{Demo4}.

  There is still one equation to write.  This time we
  again use the \texttt{deqarr} environment:
  \begin{deqarr}
  \cot \alpha & = & \frac{\cos \alpha}{\sin \alpha} \\
  \where
    & = & \frac{1}{\tan \alpha}
  \end{deqarr}
  This example also shows the use of the \verb+\where+
  command, which is a special case of the \verb+\rem+ command.
  Now, the interesting thing of referring to the recycled
  equations is ahead. If one writes \verb#\ref{Demo4}#,
  this is what \LaTeX\ will return:~\ref{Demo4}.  That is
  not too instructive, since the partial equation numbers
  are quite common in this document.  To make the complete
  reference, use \verb#\ref{Demo3}\ref{Demo4}#.  The
  reference~\ref{Demo3}\ref{Demo4} is much more
  comprehensible, right? (If you get bad line-breaks at
  such references, put them in an \verb#\mbox{...}#.)

  Finally, the $\mathcal{END}$!  If you want your
  equations left-aligned, just specify the \texttt{leqno}
  option for the \texttt{documentclass} you are using.  It
  should work!  If you have any suggestions, corrections
  or contributions, please contact me. Enjoy \LaTeX !

  {\itshape mats d.}
\end{document}
\endinput
%% 
%% End of file `delex.tex'.
